package com.dingreading.cloud.soms.mapper;

import com.dingreading.cloud.soms.dto.StoreProjectCycleDtoV2;
import com.dingreading.cloud.soms.dto.StoreProjectCycleDtoV3;
import com.dingreading.cloud.soms.entity.StoreProjectCycle;
import com.mybatisflex.core.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 映射层。
 *
 * @author Administrator
 * @since 2024-09-11
 */
public interface StoreProjectCycleMapper extends BaseMapper<StoreProjectCycle> {

    /**
     * 按门店uid、服务uid、次数或天数，查询最接近的单价
     */
    StoreProjectCycleDtoV2 getDtoByProjectUidAndCnt(
            @Param("selfStore") boolean selfStore, @Param("storeUid") String storeUid, @Param("projectUid") String projectUid,
            @Param("consumeType") Integer consumeType, @Param("cnt") Integer cnt
    );

    /**
     * 获取系统周期或门店自定义周期
     */
    StoreProjectCycle configByCycleUid(
            @Param("selfStore") boolean selfStore, @Param("storeUid") String storeUid, @Param("cycleUid") String cycleUid
    );

    /**
     * 获取系统周期和门店自定义周期
     */
    List<StoreProjectCycleDtoV2> configListByStoreUidAndProjectUid(
            @Param("selfStore") boolean selfStore, @Param("storeUid") String storeUid, @Param("projectUid") String projectUid
    );

    /**
     * 获取启用的系统周期和门店自定义周期
     */
    List<StoreProjectCycleDtoV3> configListByStoreUidAndProjectUidInAndEnabled(
            @Param("selfStore") boolean selfStore, @Param("storeUid") String storeUid, @Param("projectUidList") List<String> projectUidList
    );

}
